// 存储不同页面的搜索内容
const PageSearch = {
  state: {
    pageSearchHistory: []
  },
  mutations: {
    // v -> { module: '', data: [ {name: '',key: '', value: ''} ] }
    setPageSearchHistory (state, v) {
      const existHistory = state.pageSearchHistory.find(i => i.module === v.module)
      if (!existHistory) {
        state.pageSearchHistory.push(v)
      } else {
        const index = state.pageSearchHistory.indexOf(existHistory)
        state.pageSearchHistory[index] = v
      }
    }
  }
}

export default PageSearch
